#ifndef KEYBOARD_HOOK_H
#define KEYBOARD_HOOK_H

#include <windows.h>
#include <functional>

// Forward declaration
class DataManager;

class KeyboardHook {
public:
    
    KeyboardHook();
    ~KeyboardHook();

    bool InstallHook();
    void UninstallHook();
    bool IsHookInstalled() const { return m_hhook != nullptr; }
    
    // Set the data manager for handling click data
    void SetDataManager(DataManager* dataManager) { m_dataManager = dataManager; }
    
    // Get current click count from data manager
    int GetClickCount() const;
    
    // Callback function type for click events
    using ClickCallback = std::function<void(int)>;
    void SetClickCallback(ClickCallback callback) { m_clickCallback = callback; }

private:
    static LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam);
    static KeyboardHook* s_instance;
    
    HHOOK m_hhook;
    DataManager* m_dataManager;
    ClickCallback m_clickCallback;
    
    void OnKeyPressed();
};

#endif // KEYBOARD_HOOK_H
